package com.example.schedule;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.example.schedule.history.HistoryActivity;
import com.example.schedule.log.LogActivity;
import com.example.schedule.plan.PlanActivity;
import com.example.schedule.today.NoteActivity;
import com.example.schedule.utils.DoubleClick;

import org.litepal.LitePal;

public class MainActivity extends AppCompatActivity {

    private Button mToday;
    private Button mPlan;
    private Button mLog;
    private Button mHistory;
    public static int count = 1;
    private String TAG = "yesen";


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initView();
        initEvent();
        test();
    }

    private void test() {
        Button button = findViewById(R.id.btn);
        button.setOnClickListener(new DoubleClick() {
            @Override
            public void doubleC(View view) {
                Toast.makeText(MainActivity.this, "双击", Toast.LENGTH_SHORT).show();
            }
        });
    }

    //绑定按钮
    private void initView() {
        mToday = findViewById(R.id.main_today);
        mPlan = findViewById(R.id.main_plan);
        mLog = findViewById(R.id.main_log);
        mHistory = findViewById(R.id.main_history);
    }

    //设置按钮的活动：跳转页面
    private void initEvent() {
        mToday.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this , NoteActivity.class));
            }
        });

        mPlan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this , PlanActivity.class));
            }
        });

        mLog.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this , LogActivity.class));
            }
        });

        mHistory.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this , HistoryActivity.class));
            }
        });

    }

}